<template>
  <el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible="crud.status.cu > 0" :title="crud.status.title" width="700px">
    <el-form ref="form" :model="form" :rules="rules" size="small" label-width="120px">
      <el-form-item label="设备编号" prop="deviceSerial">
        <el-input v-model="form.deviceSerial" />
      </el-form-item>
      <el-form-item label="蓝牙mac地址" prop="bleMac">
        <el-input v-model="form.bleMac" />
      </el-form-item>
      <el-form-item label="主板电量">
        <el-input v-model="form.batteryBoard" />
      </el-form-item>
      <el-form-item label="主板电量报警">
        <el-input v-model="form.batteryBoardAlarm" />
      </el-form-item>
      <el-form-item label="锁电量">
        <el-input v-model="form.batteryLock" />
      </el-form-item>
      <el-form-item label="锁电量报警">
        <el-input v-model="form.batteryLockAlarm" />
      </el-form-item>
      <el-form-item label="硬件版本">
        <el-input v-model="form.hardVer" />
      </el-form-item>
      <el-form-item label="软件版本">
        <el-input v-model="form.softVer" />
      </el-form-item>
      <el-form-item label="设备备注">
        <el-input v-model="form.deviceRemark" />
      </el-form-item>
      <el-form-item label="设备图片">
        <el-input v-model="form.deviceImgs" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="text" @click="crud.cancelCU">取消</el-button>
      <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { form } from '@crud/crud'

const defaultForm = { deviceId: null, deviceSerial: null, bleMac: null, batteryBoard: null, batteryBoardAlarm: null, batteryLock: null, batteryLockAlarm: null, hardVer: null, softVer: null, deviceRemark: null, deviceImgs: null, deviceStatus: null, devicePublishStatus: null, hospitalId: null, buildingId: null, floorId: null, departId: null, hospitalName: null, buildingName: null, floorName: null, departName: null }
export default {
  mixins: [form(defaultForm)],
  props: {
    dict: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      rules: {
        deviceSerial: [{ required: true, message: '设备编号不能为空', trigger: 'blur' }],
        bleMac: [{ required: true, message: '蓝牙mac地址不能为空', trigger: 'blur' }]
      }
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  /deep/ .el-input-number .el-input__inner {
    text-align: left;
  }
</style>
